package com.atguigu.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.atguigu.entity.Dict;
import com.atguigu.result.Result;
import com.atguigu.service.DictService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dict")
//这里不继承baseController这个是因为,不需要里面处理动态条件查询的信息,我们这里用vo直接就获取到了
public class DictController {

    @Reference
    private DictService dictService;

    @RequestMapping("/findListByDictCode/{dictCode}")
    public Result findListByDictCode(@PathVariable String dictCode){
        //根据关键code去查询dict的子列表
        List<Dict> areaList = dictService.findListByDictCode(dictCode);
        return Result.ok(areaList);
    }

    @RequestMapping("/findListByParentId/{parentId}")
    public Result findListByParentId(@PathVariable Long parentId){
        List<Dict> plateList = dictService.findListByParentId(parentId);
        return Result.ok(plateList);
    }

}
